﻿using Libs;
using System.IO;

namespace WriteForFighting.Game.Asset
{
    static class Sound
    {
        public static int Shoot { get; private set; }
        public static int Explosion { get; private set; }

        private const string LoadWrongMessage = "ファイルの読み込みに失敗しました。";
        private const string SoundExtension = ".ogg";

        public static void Init()
        {
            {
                const string path = GD.ASSET_DIR + @"sound\shoot" + SoundExtension;
                Shoot = DX.LoadSoundMem(path);
                if (Shoot == -1)
                {
                    throw new FileLoadException(LoadWrongMessage, path);
                }
            }

            {
                const string path = GD.ASSET_DIR + @"sound\explosion" + SoundExtension;
                Explosion = DX.LoadSoundMem(path);
                if (Explosion == -1)
                {
                    throw new FileLoadException(LoadWrongMessage, path);
                }

                DX.ChangeVolumeSoundMem(180, Explosion);
            }
        }
    }
}
